from rest_framework import serializers
from cars.serializers import CarLstSerl
from mgmt.models import Batch, Security, BatchCar
from teacher.serializers import TeacherBriefSerl


class SecuritySerl(serializers.ModelSerializer):
    updated = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)

    class Meta:
        model = Security
        exclude = ("created",)


class BatchSerl(serializers.ModelSerializer):
    creater = TeacherBriefSerl()
    updated = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)

    class Meta:
        model = Batch
        exclude = ("created",)


class BatchCarSerl(serializers.ModelSerializer):
    car = CarLstSerl()
    creater = TeacherBriefSerl()
    updated = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)

    class Meta:
        model = BatchCar
        exclude = ("created",)